package com.gdth.bank.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gdth.bank.R;
import com.gdth.bank.bean.AppDevBean;
import com.gdth.model.ImageItem;

import java.util.List;

/**
 * @author xjc
 * 创建时间： 2020/5/12 9:44 AM
 * @version V1.0
 * 用途:
 */
public class UnbindAppAdapter extends BaseAdapter {

    private LayoutInflater mInflater;

    private Context context;

    private List<AppDevBean.YhListBean> mData;

    public UnbindAppAdapter(Context context, List<AppDevBean.YhListBean> mData) {
        this.mInflater = LayoutInflater.from(context);
        this.context = context;
        this.mData = mData;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return this.mData.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return this.mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        AppDevBean.YhListBean model = mData.get(position);
        final int number = position;
        UnbindAppAdapter.ViewHolder holder;
        //观察convertView随ListView滚动情况
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_appdev_list, null);
            holder = new UnbindAppAdapter.ViewHolder();
            /*得到各个控件的对象*/
            holder.sjzblx = (TextView) convertView.findViewById(R.id.sjzblx);
            holder.sfz = (TextView) convertView.findViewById(R.id.sfz);



            convertView.setTag(holder);//绑定ViewHolder对象
        }else{
            holder = (UnbindAppAdapter.ViewHolder)convertView.getTag();//取出ViewHolder对象
        }

        holder.sjzblx.setText(model.getSJZDLX());
        holder.sfz.setText(model.getSFZ());

        return convertView;
    }

    public final class ViewHolder{
        public TextView sfz;
        public TextView sjzblx;

    }

    private JtcyXxbListAdapter.OnJtcyXxDetailClickListener mOnJtcyXxDetailClickListener;

    public void setmOnJtcyXxDetailClickListener(
            JtcyXxbListAdapter.OnJtcyXxDetailClickListener mOnJtcyXxDetailClickListener) {
        this.mOnJtcyXxDetailClickListener = mOnJtcyXxDetailClickListener;
    }

    public interface OnJtcyXxDetailClickListener {
        void clickListener(int position);
        void clickdelListener(int position);
    }
}
